package test;

public class Hello {

	/*ThreadLocal<Long> longLocal = new ThreadLocal<Long>(){
		@Override
		protected Long initialValue() {
			return Thread.currentThread().getId();
		}
	};
	ThreadLocal<String> stringLocal = new ThreadLocal<String>(){
		protected String initialValue() {
			return Thread.currentThread().getName();
		};
	};*/
	
	
	ThreadLocal<Long> longLocal = new ThreadLocal<Long>();
	ThreadLocal<String> stringLocal = new ThreadLocal<String>();
	
	/*public void set(){
		longLocal.set(Thread.currentThread().getId());
		stringLocal.set(Thread.currentThread().getName());
	}*/
	
	public  long getLong(){
		return longLocal.get();
	}
	
	public String getString(){
		return stringLocal.get();
	}
	
	public static void main(String[] args) throws InterruptedException {
		final Hello hell = new Hello();
//		hell.set();
		System.out.println(hell.getLong());
		System.out.println(hell.getString());
		
		Thread thread1 = new Thread(){

			@Override
			public void run() {
//				hell.set();
				System.out.println(hell.getLong());
				System.out.println(hell.getString());
			}
		};
		thread1.start();
		thread1.join();
		
		System.out.println(hell.getLong());
		System.out.println(hell.getString());
	}
}
